Repository navigation
feat(core-architecture): consolidate dependencies, Swagger docs, and cache - #4
Merged
Merged
Conversation
…onis-autoswagger Consolidates every dependency the README's Tech Stack table calls for onto this branch instead of letting later branches install them one at a time. Also adds argon2 to allowScripts since its install step needs to run for the native binding to be usable.
Wires all four packages' providers and commands into adonisrc.ts, and registers the bouncer initialization middleware in start/kernel.ts, so the IoC container can resolve ctx.bouncer, the mail service and the cache service anywhere in the app.
Generated by the package's own configure command. The Edge template sharing branch in the middleware is removed since this project has no view provider, API only per the README's architecture. The policies.ts registry is empty for now, no policy classes exist yet.
Database store over Redis, matching this project's pattern of reusing the one shared PostgreSQL instance instead of adding a second piece of infrastructure. The default is hardcoded to 'database' rather than read from LIMITER_STORE, since 'redis' is a documented but unconfigured env value with no matching store here. A global throttle stub is defined in start/limiter.ts for feature/auth to point at the real auth routes.
SMTP is the only transport this project needs. The generated globals block for Edge template variables is removed, this project has no view provider and mail bodies are built as plain strings in the mailer classes that later branches add.
Same reasoning as the limiter: the database driver reuses the existing pg connection instead of adding Redis. Most reads never touch the database at all since the memory layer sits in front of it; the README names the categories list as a candidate for this once that branch exists.
/swagger returns the generated OpenAPI spec, /docs renders it through Swagger UI, both public. tagIndex is set to 3 to match this project's /api/v1/<resource> route convention, and authMiddlewares points at the auth named middleware so protected routes are flagged with the bearer token security scheme automatically.
…y, validate mail vars APP_KEY was weakened from Env.schema.secret() to string() when this file first added the auth, database and hashing env variables, losing log redaction for the key backing session and cookie encryption. Fixed at the source. JWT_SECRET gets the same protection since it signs every issued token. Mail variables are validated the same way every other env var in this project is.
Adds the SMTP_HOST/SMTP_PORT/MAIL_* section to all three env files, pointed at the Mailhog service docker-compose.yml and docker-compose.test.yml now run, ports 1025 and 1026 respectively.
Catches every outgoing email instead of attempting real delivery. Test stack uses offset ports (1026/8026) so both compose files can run side by side, the same reasoning docker-compose.test.yml already applies to its postgres service.
Needed once a later branch sends real email in a functional test.
Both auto-generated, refreshed to reflect the new routes and the rate_limits/cache tables. Neither is hand edited.
The Tasks list now names every package the whole project's Tech Stack table needs, installed once here instead of one at a time as later branches reach the point of needing them. Bouncer, limiter and mail get their base scaffolding here too; the app-specific wiring each one needs (the JWT guard, Argon2 as the active hasher, real policies) still belongs to the branch whose behavior it is.
Reconciles feature/core-architecture (recreated from its original tip and extended with the full dependency and configuration consolidation requested mid-session) with everything data-modeling and auth already built on top of the original scaffold. Conflicts resolved in favor of develop's already-working versions wherever both branches touched the same concern: the real env-driven authThrottle over the generic limiter stub, the TEST_ADMIN_EMAIL block in start/env.ts, and the auth-schema rate_limits migration over the duplicate one this branch generated independently, which is removed here rather than kept alongside it. Genuinely new pieces are additive: adonis-autoswagger with /swagger and /docs, @adonisjs/cache with a database backed L2 layer, and the APP_KEY/JWT_SECRET Secret redaction fix applied at its actual source commit. Verified against a live PostgreSQL and Mailhog instance after resolution: migrations run cleanly to 14 tables, seeders complete, and the full test suite passes 41 of 41.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This reconciles feature/core-architecture, recreated from its original historical tip after a mid-session request to consolidate every dependency the whole project needs at the foundation instead of asking approval branch by branch, with everything data-modeling and auth already built on top of the original scaffold. It adds three things genuinely new to the project and fixes one real regression, nothing else changes.
adonis-autoswagger is installed and wired up with /swagger and /docs routes, closing a task that was listed in this branch's own checklist from the start but never actually done. @adonisjs/cache is installed and configured with an in-memory L1 layer over a database backed L2 layer, the same reasoning as the rate limiter's own store choice, reusing the existing PostgreSQL instance instead of adding Redis as a second piece of infrastructure. Every remaining dependency the README's Tech Stack table names, pg, bouncer, limiter, mail, argon2, jose, is confirmed installed here too, even though data-modeling and auth already installed most of them independently when this branch had not yet caught up, so the full set is now visibly present at the point in history where the README says it belongs.
The regression fix is APP_KEY, which lost its Secret redaction (Env.schema.secret() weakened to a plain string()) in this branch's own original env.ts commit, before data-modeling or auth ever touched the file. Fixed at that actual source point rather than only in the branches built on top of it, and JWT_SECRET gets the same protection since it signs every issued token.
Test plan
npm run typecheck, npm run lint and npm test all pass against a live PostgreSQL and Mailhog instance, 41 tests passing with zero failures, verified after resolving the merge against develop's current state and regenerating the codegen and schema snapshot files that conflict resolution touched.